372dc4b71317778bfd7f353a47a1ca21cbbbb4ca,src/main/java/betterquesting/commands/admin/QuestCommandLives.java,QuestCommandLives,runCommand,#MinecraftServer#CommandBase#ICommandSender#String[]#,50
Before Change
if(player != null)
{
LifeManager.AddRemoveLives(player, value);
sender.addChatMessage(new TextComponentString((value >= 0? "Added " : "Removed ") + Math.abs(value) + " lives " + (value >= 0? "to " : "from ") + player.getName() + " (Total: " + LifeManager.getLives(player) + ")"));
} else
{
for(EntityPlayerMP p : server.getPlayerList().getPlayerList())
After Change
String action = args[1];
EntityPlayerMP player = args.length < 4? null : server.getPlayerList().getPlayerByUsername(args[3]);
if(player == null && args.length == 4)
{
throw getException(command);
}
int value = 0;
try
{
value = Integer.parseInt(args[2]);
} catch(Exception e)
{
throw getException(command);
}
if(action.equalsIgnoreCase("set"))
{
value = Math.max(1, value);
if(player != null)
{
LifeManager.setLives(player, value);
sender.addChatMessage(new TextComponentTranslation("betterquesting.cmd.lives.set_player", player.getName(), value));
} else if(args.length == 3)
{
for(EntityPlayerMP p : server.getPlayerList().getPlayerList())
{
LifeManager.setLives(p, value);
}
sender.addChatMessage(new TextComponentTranslation("betterquesting.cmd.lives.set_all", value));
}
} else if(action.equalsIgnoreCase("add"))
{
if(player != null)
{
LifeManager.AddRemoveLives(player, value);
if(value >= 0)
{
sender.addChatMessage(new TextComponentTranslation("betterquesting.cmd.lives.add_player", value, player.getName(), LifeManager.getLives(player)));
} else
{
sender.addChatMessage(new TextComponentTranslation("betterquesting.cmd.lives.remove_player", Math.abs(value), player.getName(), LifeManager.getLives(player)));
}
} else
{
for(EntityPlayerMP p : server.getPlayerList().getPlayerList())
{
LifeManager.AddRemoveLives(p, value);
}
if(value >= 0)
{
sender.addChatMessage(new TextComponentTranslation("betterquesting.cmd.lives.add_all", value));
} else
{
sender.addChatMessage(new TextComponentTranslation("betterquesting.cmd.lives.remove_all", Math.abs(value)));